//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "RLCNSSRV.h"
#include "DPCnsSrv.h"
#include "DMCnsSrv.h"
#include "STDMCNSV.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "PHReport"
#pragma link "PHRBand"
#pragma link "PHRLabel"
#pragma link "PHDS"
#pragma link "PHDS"
#pragma link "PHDS"
#pragma link "PHDS"
#pragma link "PHDS"
#pragma resource "*.dfm"
TRLCnsSrv1 *RLCnsSrv1;

//---------------------------------------------------------------------------
__fastcall TRLCnsSrv1::TRLCnsSrv1(TComponent *Owner) : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TRLCnsSrv1::PHReport1NeedData(PHReport *Sender,bool &MoreData)
{
 if(!PrimeiraVez)
  DSCnsServ->Next();
 PrimeiraVez = false;
 MoreData = !DSCnsServ->Eof;
 if((int)DSCnsServ->GV(CNSRV_MES) == 0 && TipoRelatorio != 0)
  {
   PHRBand2->Frame->DrawTop = true;
   PHRLabel1->Fonte->Bold = true;
   PHRLabel2->Fonte->Bold = true;
   PHRLabel3->Fonte->Bold = true;
   PHRLabel4->Fonte->Bold = true;
   PHRLabel10->Fonte->Bold = true;
  }
 else
  {
   PHRBand2->Frame->DrawTop = false;
   PHRLabel1->Fonte->Bold = false;
   PHRLabel2->Fonte->Bold = false;
   PHRLabel3->Fonte->Bold = false;
   PHRLabel4->Fonte->Bold = false;
   PHRLabel10->Fonte->Bold = false;
  }
 if((int)DSCnsServ->GV(CNSRV_NIVEL) == 1)
  {
   PHRBand2->Frame->DrawBottom = true;
   PHRBand2->Frame->DrawLeft = true;
   PHRBand2->Frame->DrawRight = true;
   PHRBand2->Frame->DrawTop = true;
  }
}
//---------------------------------------------------------------------------

void __fastcall TRLCnsSrv1::PHReport1BeforePrint(TObject *Sender,
      bool &PrintReport)
{
 DSCnsServ->Open(true);
 DSCnsServ->First();
 PrintReport = DSCnsServ->CountReg() > 0;
 PrimeiraVez = true;
}
//---------------------------------------------------------------------------

void __fastcall TRLCnsSrv1::PHReport1AfterPrint(PHReport *Sender)
{
 DSCnsServ->Close(); 
}
//---------------------------------------------------------------------------

